#!/usr/bin/python
# -*- coding: utf-8 -*-

import unittest
from trivmoo.design_patterns.factory.generic_factory import GenericFactory

class TestGenericFactory(unittest.TestCase):
    def test_factory(self):
        factory = GenericFactory()
        a_object = factory.create('test_classes', 'MyClass1', {})
        from trivmoo.design_patterns.factory.test_classes import MyClass1
        self.assertTrue(isinstance(a_object, MyClass1))
        a_object = factory.create('test_classes', 'MyClass2', {})
        from trivmoo.design_patterns.factory.test_classes import MyClass2
        self.assertTrue(isinstance(a_object, MyClass2))
        
        
if __name__ == "__main__":
    unittest.main()
    
